package com.ccp.dev.workflow.model.bpm;

import com.ccp.dev.core.basic.model.BaseModel;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

/**
 * ClassDescribe:
 * 节点特权
 * @author :wangcheng
 * Date: 2019-09-06
 */
public class BpmNodePrivilege extends BaseModel<BpmNodePrivilege> {

    /**
     * 特权id
     */
    protected String privilegeId;
    /**
     * 流程定义id
     */
    protected String procDefId;
    /**
     * 流程节点ID
     */
    protected String nodeId;
    /**
     * 0=拥有所有特权
     * 1=允许直接处理
     * 2=允许一票制
     * 3=允许补签
     */
    protected Long privilegeMode;
    /**
     * 0=发起人
     * 1=用户
     * 2=角色
     * 3=组织
     * 4=组织负责人
     * 5=岗位
     * 6=上下级
     * 7=用户属性
     * 8=组织属性
     * 9=本部门
     * 10=为某个节点的执行人
     * 11=动态计算(如来自指定的方法或接口，如可允许来自上个表单的用户选择)
     */
    protected Long userType;
    /**
     * 特权人
     */
    protected String cmpNames;
    /**
     * 特权id
     */
    protected String cmpIds;

    public String getPrivilegeId() {
        return privilegeId;
    }

    public void setPrivilegeId(String privilegeId) {
        this.privilegeId = privilegeId;
    }

    public String getProcDefId() {
        return procDefId;
    }

    public void setProcDefId(String procDefId) {
        this.procDefId = procDefId;
    }

    public String getNodeId() {
        return nodeId;
    }

    public void setNodeId(String nodeId) {
        this.nodeId = nodeId;
    }

    public Long getPrivilegeMode() {
        return privilegeMode;
    }

    public void setPrivilegeMode(Long privilegeMode) {
        this.privilegeMode = privilegeMode;
    }

    public Long getUserType() {
        return userType;
    }

    public void setUserType(Long userType) {
        this.userType = userType;
    }

    public String getCmpNames() {
        return cmpNames;
    }

    public void setCmpNames(String cmpNames) {
        this.cmpNames = cmpNames;
    }

    public String getCmpIds() {
        return cmpIds;
    }

    public void setCmpIds(String cmpIds) {
        this.cmpIds = cmpIds;
    }

    /**
     * @see java.lang.Object#equals(Object)
     */
    @Override
    public boolean equals(Object object) {
        if (!(object instanceof BpmNodePrivilege)) {
            return false;
        }
        BpmNodePrivilege rhs = (BpmNodePrivilege) object;
        return new EqualsBuilder().append(this.privilegeId, rhs.privilegeId)
                .append(this.procDefId, rhs.procDefId)
                .append(this.nodeId, rhs.nodeId)
                .append(this.privilegeMode, rhs.privilegeMode)
                .append(this.userType, rhs.userType)
                .append(this.cmpNames, rhs.cmpNames)
                .append(this.cmpIds, rhs.cmpIds).isEquals();
    }

    /**
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode() {
        return new HashCodeBuilder(-82280557, -700257973)
                .append(this.privilegeId).append(this.procDefId)
                .append(this.nodeId).append(this.privilegeMode)
                .append(this.userType).append(this.cmpNames)
                .append(this.cmpIds).toHashCode();
    }

    /**
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        return new ToStringBuilder(this)
                .append("privilegeId", this.privilegeId)
                .append("procDefId", this.procDefId)
                .append("nodeId", this.nodeId)
                .append("privilegeMode", this.privilegeMode)
                .append("userType", this.userType)
                .append("cmpNames", this.cmpNames)
                .append("cmpIds", this.cmpIds).toString();
    }
}
